This relates to a system for managing data received by an electronic device.
Users of electronic devices may access different content by transmitting appropriate requests to servers. In response to a request, a server may transmit the requested data to the requesting electronic device. The electronic device may locally store or cache the received data for processing by one or more applications of the electronic device. For example, the electronic device may request a media file (e.g., a video), and cache or store in memory the requested media file for playback for the user.
In some embodiments, the user of the electronic device may request a file that exceeds the capacities of the electronic device. For example, the user may request a file that is larger than the available memory or cache of the electronic device. To accommodate excessive files, and in particular to accommodate excessively large files, the electronic device may selectively cache or store in memory received data.
Using an approach known in the art, the electronic device may continuously store incoming data provided using a speculative read from the network by replacing the last used data block stored in cache or in memory with the new data. While such an approach may be sufficient for non-media files, it may be inefficient when storing media files. In particular, such an approach may not take into account the nature of the media file, and may cause the electronic device to evict unused data blocks or recently read data blocks that are of more interest than the newly received data.
Accordingly, there is a need for a system and process by which an electronic device may selectively evict data from cache in favor of newly received data based on the identity of the newly received data. In particular, it may be desirable to assign a dynamic value to each data block of a file for determining whether or not to cache data received by an electronic device.